package com.example.kbase;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class ForgetActivity extends Activity implements View.OnClickListener{
    private Button get;
    private ImageView back;
    CountDownTimer cdt = new CountDownTimer(60000, 1000) {
        @Override
        public void onTick(long millisUntilFinished) {
            get.setClickable(true);
            get.setTextColor(Color.WHITE);
            get.setText((millisUntilFinished / 1000) + "秒");
        }

        @Override
        public void onFinish() {
            get.setText("Get Identify Code.");
        }
    };
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_forget);
        get = findViewById(R.id.getCode);
        back = findViewById(R.id.backToLogin);

        get.setOnClickListener(this);
        back.setOnClickListener(this);

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.getCode:
                cdt.start();
                break;
            case R.id.backToLogin:
                Intent i = new Intent(ForgetActivity.this,LoginActivity.class);
                startActivity(i);
                overridePendingTransition(R.anim.go_in, R.anim.go_out);
                finish();
                break;
        }
    }
}
